#include <stdio.h>

int main()
{
	int n = 0;
	scanf_s("%d", &n);
	int arr[20][20] = { 0 };
	int left = 0;
	int right = n;
	int up = 0;
	int down = n;
	int x = 1;
	while (x<=n*n)
	{
		for (int i = left; i < right; i++)
		{
			arr[up][i] = x++;
		}
		up++;
		for (int i = up; i < down; i++)
		{
			arr[i][right-1]=x++;
		}
		right--;
		for (int i = right-1; i >=left; i--)
		{
			arr[down-1][i] = x++;
		}
		down--;
		for (int i = down-1; i >=up; i--)
		{
			arr[i][left] = x++;
		}
		left++;
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d\t", arr[i][j]);
		}
		printf("\n");
	}

	return 0;
}